package team.sun.sss.dao.hardwork;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import team.sun.sss.pojo.hardwork.HwLabor;

import java.util.List;


@Mapper
@Repository
public interface HwLaborDao {
    //1.学工处显示所有用人单位申请表
    @Select("select * from hw_labor ")
    List<HwLabor> getHwLaborList();

    @Select("select * from hw_labor where batch_team=#{batchTeam} and labor_unit=#{laborUnit} and labor_state=#{laborState}")
    List<HwLabor> selectLabor(String batchTeam ,String laborUnit, String laborState);
    //1.3学生只显示审批状态为通过的用人单位申请表labor_approval_state
    @Select("select * from hw_labor where labor_approval_state=\"审核通过\" ")
    List<HwLabor> stuHwLaborList();

    //1.2用人单位显示某条具体的申请表
    @Select("select * from hw_labor where labor_num=#{laborNum} ")
    List<HwLabor> HwLaborDetaile(int laborNum);

    //2.学工只能修改用人单位申请表的状态
    @Update("update hw_labor set labor_approval_state=#{laborApprovalState} " +
            "where labor_num=#{laborNum} ")
    int updateHwLabor(int laborNum,String laborApprovalState );

    //3.用人单位撤回申请
    @Delete("delete from hw_labor where batch_team=#{batchTeam}  and batch_team=#{laborUnit")
    int deleteHwLabor( String laborUnit,String batchTeam);

    //4.用人单位填写申请
    @Insert("insert into hw_labor(batch_team,labor_unit,labor_request_num,labor_recruiters_num," +
            "labor_standard,labor_reason,labor_submit_time,labor_approval_state) values" +
            "(#{batchTeam},#{laborUnit},#{laborRequestNum},#{laborRecruitersNum}," +
            "#{laborStandard},#{laborReason},#{laborSubmitTime},#{larborApprovalState})")
    int addHwLabor(String batchTeam,String laborUnit,int laborRequestNum,int laborRecruitersNum,
                   String laborStandard,String laborReason,String laborSubmitTime,String larborApprovalState);

}

